require('./Listitem.styl');
import { Boxs } from 'saltui'
import Icon from 'salt-icon'
import { Control } from 'react-keeper'
const { HBox, Box, VBox } = Boxs;
const classNames = require("classnames")
const repairType = { 0: "待维修", 1: "维修中", 2: "维修成功" }
class Listitem extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
        };
        this.handleClick = this.handleClick.bind(this);
    }
    handleClick() {
        if (this.props.refreshing) return;
        let { id } = this.props
        Control.go('/home/repairdetail', { id })
    }
    render() {
        return (
            <div className="teacher-listitem" onClick={this.handleClick}>
                <VBox className="teacher-listitem-box">
                    <HBox vAlign="center">
                        <Box flex={1} className={classNames("teacher-listitem-title", { "over": this.props.repairStatus == 2 })}>
                            {this.props.repairType}
                        </Box>
                        <Box flex={1} className="t-FAR teacher-listitem-date">
                            {this.props.repairDatetime}
                        </Box>
                    </HBox>
                    <HBox className={classNames("teacher-listitem-content t-MT10", { "over": this.props.repairStatus == 2 })}>
                        <Box flex={1}>{this.props.description}</Box>
                        <Box flex={1} className={classNames("t-FAR", { "noover": this.props.repairStatus != 2 })}>{repairType[this.props.repairStatus]}</Box>
                    </HBox>
                </VBox>
            </div>
        );
    }

    componentWillMount() {
    }

    componentDidMount() {
    }

    componentWillReceiveProps(nextProps) {
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true;
    }

    componentWillUpdate(nextProps, nextState) {
    }

    componentDidUpdate(prevProps, prevState) {
    }

    componentWillUnmount() {
    }
}

module.exports = Listitem;
